﻿<%@ Page Title="" Language="C#" MasterPageFile="~/controlasistencia/Plantilla.Master" AutoEventWireup="true" CodeBehind="horarioIndividual.aspx.cs" Inherits="Presentacion.horarioIndividual" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <%  if (Request.QueryString["cod"] == null)
        {
            Response.Redirect("listaDistribucion.aspx");
        }
    %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contenido" runat="server">
    <div class="row">
        <div class="col-lg-12">
            <div class="page-title">
                <%
                    Negocio.catalogos.catalogoDistribucion _obj = new Negocio.catalogos.catalogoDistribucion();
                    var codigoDistribucion = new Presentacion.encriptaje().decodeControlAsistencia(Request.QueryString["cod"].ToString());
                    var materias = _obj.obtenerDistribucionId(Convert.ToInt32(codigoDistribucion)).First();
                       
                %>

                        <h1><%Response.Write("CARRERA DE "+ materias.carrera);%> <small> <% Response.Write(materias.Nombre); %></small></h1>               
                <ol class="breadcrumb">
                    <li><i class="fa"></i><a href="index.aspx" class="tamano-breadcrumbs">Inicio</a>
                    </li>
                    <li><i class="fa"></i><a href="listaDistribucion.aspx" class="tamano-breadcrumbs">Materias</a>
                    </li>
                    <li class="active tamano-breadcrumbs">Horario Individual</li>
                </ol>
            </div>
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
    <div class="col-lg-12">
        <div class="portlet portlet-default">
            <div class="box-body no-padding">
                <!-- THE CALENDAR -->
                <form id="form1" runat="server">
                    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
                    </asp:ScriptManager>
                    <div class="clearfix"></div>
                    <div class="portlet-body">
                        <h3 class="text-green" style="text-align: center"><b>HORARIO DE CLASES</b></h3>
                        <div id="calendar"></div>
                    </div>
                    <!-- /.portlet -->
                </form>

                <%--</br>
                                    <center><button class="btn btn-green">Confirmar</button></center>--%>
            </div>
            <!-- /.box-body -->
        </div>
        <!-- /. box -->
    </div>
    <!-- /.col -->

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">

    <!-- Funciones para lanzar los mensajes de eventos -->
    <script src="js/notifications.js"></script>
    <script>
        function rgb2hex(rgb) {
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            return "#" +
             ("0" + parseInt(rgb[1], 10).toString(16)).slice(-2) +
             ("0" + parseInt(rgb[2], 10).toString(16)).slice(-2) +
             ("0" + parseInt(rgb[3], 10).toString(16)).slice(-2);
        }
        $(function () {

            /* initialize the external events
             -----------------------------------------------------------------*/
            function ini_events(ele) {
                ele.each(function () {

                    // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
                    // it doesn't need to have a start or end
                    var eventObject = {
                        
                        title: $.trim($(this).text()) // use the element's text as the event title
                    };

                    // store the Event Object in the DOM element so we can get to it later
                    $(this).data('eventObject', eventObject);

                    // make the event draggable using jQuery UI
                    $(this).draggable({
                        zIndex: 1070,
                        revert: true, // will cause the event to go back to its
                        revertDuration: 0  //  original position after the drag
                    });

                });
            }
            ini_events($('#external-events div.external-event'));

            /* initialize the calendar
             -----------------------------------------------------------------*/
            //Date for the calendar events (dummy data)
            
            var date = new Date();
            var d = date.getDate(),
                m = date.getMonth(),
                y = date.getFullYear();
            $('#calendar').fullCalendar({
                defaultView: 'agendaWeek',
                left: 'prev,next today',
                weekends: false,
                allDaySlot: false,
                <%
        var codigoDistribucion = new Presentacion.encriptaje().decodeControlAsistencia(Request.QueryString["cod"]);
        Response.Write(controlasistencia_horarioindividual_aspx.obtenerSeccion(int.Parse(codigoDistribucion.ToString()), int.Parse(Session["idDocente"].ToString())));
        
                 %>
                defaultEventMinutes : 60,

                header: {
                    left:false,
                    right: 'agendaWeek,agendaDay',
                    center: false,
                },
                columnFormat: {
                    month: 'ddd',
                    week: 'ddd',
                    day: 'dddd'
                },
                axisFormat: 'H:mm', //,'h(:mm)tt',
                timeFormat: {
                    agenda: 'H:mm' //h:mm{ - h:mm}'
                },
                
                buttonText: {//This is to add icons to the visible buttons
                    week: 'Semana',
                    day: 'Hoy'
                },
                editable: false,
                selectable: false,
                droppable: false, // this allows things to be dropped onto the calendar !!!
                events: <% codigoDistribucion = new Presentacion.encriptaje().decodeControlAsistencia(Request.QueryString["cod"]); Response.Write(controlasistencia_horarioindividual_aspx.obtenerHorarioIndividual(int.Parse(Session["idDocente"].ToString()), int.Parse(Session["periodo"].ToString()), int.Parse(codigoDistribucion))); %>,
                
                
            });
        });
    </script>
</asp:Content>
